package design_pattern

import "sync"

// 建造者模式
type builder struct {
	once *sync.Once
	msg *Message
}
func Builder() *builder  {
	return &builder{
		once: &sync.Once{},
		msg:&Message{

		},
	}
}
func (b *builder) WithHead(h string) *builder  {
	b.msg.Head=h
	return b
}
func (b *builder) WithBody(body string) *builder  {
	b.msg.Body=body
	return b
}